<!DOCTYPE html>
<head>
<meta charset="utf-8">
<meta name="author" content="AJJ">
<title>原型链练习</title>
<style>
        
</style>
</head>
<body>
    
</body>
<html>
<script>
    function People(name,age,isMale){
        this.name=name;
        this.age=age;
        this.isMale=isMale;
    }
    People.prototype.say=function(){
        console.log(this.name+'说要好好学习');
    }
    function Boy(name,age,isMale){
        People.call(this,name,age,isMale);
    }
    
    
    function Temp(){};
    Temp.prototype=People.prototype;
    Boy.prototype=new Temp();
    Boy.prototype.play=function(game,hours){
        console.log(this.name+'玩'+game+hours+'个小时');
    }
    var boy=new Boy('Tom',18,true);
    console.dir(boy);
    boy.say();
    boy.play('蛇蛇争霸',2);

console.log('----------------------------------------------');
    function Girl(name,age,isMale){
        People.call(this,name,age,isMale);
    }
    function T(){
        this.isLongHair=true;
        // this.name=name;
    };
    T.prototype=People.prototype;
    Girl.prototype=new T();
    Girl.prototype.goShopping=function(place,hours){
        console.log(this.name+'去'+place+'逛了'+hours+'个小时');
    }
    var girl=new Girl('Lily',20,false);
    console.dir(girl);
    girl.say();
    girl.goShopping('乐尚',3);
</script>